package com.ruoyi.patrol.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.patrol.mapper.PtProcessOpinionMapper;
import com.ruoyi.patrol.domain.PtProcessOpinion;
import com.ruoyi.patrol.service.IPtProcessOpinionService;

/**
 * 流程意见Service业务层处理
 * 
 * @author lkm
 * @date 2022-11-10
 */
@Service
public class PtProcessOpinionServiceImpl implements IPtProcessOpinionService 
{
    @Autowired
    private PtProcessOpinionMapper ptProcessOpinionMapper;

    /**
     * 查询流程意见
     * 
     * @param id 流程意见ID
     * @return 流程意见
     */
    @Override
    public PtProcessOpinion selectPtProcessOpinionById(Long id)
    {
        return ptProcessOpinionMapper.selectPtProcessOpinionById(id);
    }

    /**
     * 查询流程意见列表
     * 
     * @param ptProcessOpinion 流程意见
     * @return 流程意见
     */
    @Override
    public List<PtProcessOpinion> selectPtProcessOpinionList(PtProcessOpinion ptProcessOpinion)
    {
        String opinion = ptProcessOpinion.getOpinion();
        String endTime = ptProcessOpinion.getEndTime();
        String businessKey = ptProcessOpinion.getBusinessKey();
        int isAgree = ptProcessOpinion.getIsAgree();
        String taskName = ptProcessOpinion.getTaskName();
        ptProcessOpinion.setOpinion(opinion);
        ptProcessOpinion.setEndTime(endTime);
        ptProcessOpinion.setBusinessKey(businessKey);
        ptProcessOpinion.setIsAgree(isAgree);
        ptProcessOpinion.setTaskName(taskName);
        return ptProcessOpinionMapper.selectPtProcessOpinionList(ptProcessOpinion);
    }

    /**
     * 新增流程意见
     * 
     * @param ptProcessOpinion 流程意见
     * @return 结果
     */
    @Override
    public int insertPtProcessOpinion(PtProcessOpinion ptProcessOpinion)
    {
        ptProcessOpinion.setCreateTime(DateUtils.getNowDate());
        return ptProcessOpinionMapper.insertPtProcessOpinion(ptProcessOpinion);
    }

    /**
     * 修改流程意见
     * 
     * @param ptProcessOpinion 流程意见
     * @return 结果
     */
    @Override
    public int updatePtProcessOpinion(PtProcessOpinion ptProcessOpinion)
    {
        String taskName = ptProcessOpinion.getTaskName();
        String opinion = ptProcessOpinion.getOpinion();
        String businessKey = ptProcessOpinion.getBusinessKey();
        Long id = ptProcessOpinion.getId();

        ptProcessOpinion.setUpdateTime(DateUtils.getNowDate());
        return ptProcessOpinionMapper.updatePtProcessOpinion(ptProcessOpinion);
    }

    /**
     * 批量删除流程意见
     * 
     * @param ids 需要删除的流程意见ID
     * @return 结果
     */
    @Override
    public int deletePtProcessOpinionByIds(Long[] ids)
    {
        return ptProcessOpinionMapper.deletePtProcessOpinionByIds(ids);
    }

    /**
     * 删除流程意见信息
     * 
     * @param id 流程意见ID
     * @return 结果
     */
    @Override
    public int deletePtProcessOpinionById(Long id)
    {
        return ptProcessOpinionMapper.deletePtProcessOpinionById(id);
    }
}
